#ifndef SIMULATION_H
#define SIMULATION_H

#include <time.h>
#include "io_type.h"
#include "generator.h"
#include "Observer.h"
#include "Semaphor_queue.h"
#include "road_sensor.h"
#include "controller.h"
#include "time_controller.h"
#include "extension_controller.h"
#include "fuzzy_controller.h"
#include "road_queue.h"

class Simulation
{
public:
	Simulation(string sim_name, int controller_type);

	int initialize(istream &settings);
	void doSimulation();
	void printResults();
	double getTotalAverage();
	long getTotalDenied();

private:
	string simulation_name;

	// Simulation settings
	int s_controller_type;
	int s_simulation_time;
	// Top-level component (crossroad)
	adevs::Digraph<io_type*> crossroad;
	// Semaphor controller
	Controller* ctrl;
	// Components for each crossroad side
	Generator* generators[4];
	SemaphorQueue* semaphors[4];
	Observer* observers[4];
	RoadQueue* queues[4];
};

#endif // SIMULATION_H
